<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:head>
	<title>FuelManager</title>
</h:head>
<h:body>
	<ui:composition template="template/layout.xhtml">

		<ui:define name="content">
			<h:form>
				<p:tabView id="tabs" style="width:1050px;">
					<p:tab id="tab1" title="${messages.addInscription}">
						<p:panelGrid id="addInscription">
							<f:facet name="header">
								Add inscription
								<p:messages id="msg" />
							</f:facet>
							<p:row>
								<p:column styleClass="invisible">
									<p:outputLabel for="meterState" value="${messages.meterState}" />
								</p:column>
								<p:column styleClass="invisible">
									<p:inputText id="meterState" value="#{inscriptionBean.inscription.meterState}" label="meterState">
										<p:ajax process="@this" />
									</p:inputText>
								</p:column>
							</p:row>
							<p:row>
								<p:column styleClass="invisible">
									<p:outputLabel for="expenses" value="${messages.fuelExpenses}" />
								</p:column>
								<p:column styleClass="invisible">
									<p:inputText id="expenses" value="#{inscriptionBean.inscription.expenses}" label="expenses">
										<p:ajax process="@this" />
									</p:inputText>
								</p:column>
							</p:row>
							<p:row>
								<p:column styleClass="invisible">
									<p:outputLabel for="fuelAmount" value="${messages.amount}" />
								</p:column>
								<p:column styleClass="invisible">
									<p:inputText id="fuelAmount" value="#{inscriptionBean.inscription.amount}" label="amount">
										<p:ajax process="@this" />
									</p:inputText>
								</p:column>
							</p:row>
							<p:row>
								<p:column styleClass="invisible">
									<p:outputLabel for="fuelKindRatio" value="${messages.kind}" />
								</p:column>
								<p:column styleClass="invisible">
									<p:selectOneRadio id="fuelKindRatio" value="#{inscriptionBean.inscription.fuelKind}" styleClass="noBorder">
										<f:selectItem itemLabel="${messages.lpg}" itemValue="LPG" styleClass="invisible"/>
										<f:selectItem itemLabel="${messages.petrol}" itemValue="PETROL" styleClass="invisible"/>
										<f:selectItem itemLabel="${messages.diesel}" itemValue="DIESEL" styleClass="invisible"/>
									</p:selectOneRadio>
								</p:column>
							</p:row>
							<p:row>
								<p:column styleClass="invisible">
								</p:column>
								<p:column styleClass="invisible">
									<p:commandButton value="${messages.insert}" action="#{inscriptionBean.saveData}" icon="ui-icon-save" ajax="false"
										update="msg" />
								</p:column>
							</p:row>
						</p:panelGrid>
					</p:tab>
					<p:tab id="tab2" title="${messages.fromDatabase}">
						<p:dataTable id="inscriptionTable" var="inscription" value="#{inscriptionBean.inscriptionsList}" style="width:550px">
							<p:column headerText="${messages.id}" style="width:10px">
								<p:outputLabel value="#{inscription.idInscription}" />
							</p:column>

							<p:column headerText="${messages.meterState}" style="width:10px">
								<h:outputText value="#{inscription.meterState}" />
							</p:column>

							<p:column headerText="${messages.fuelExpenses}" style="width:10px">
								<h:outputText value="#{inscription.expenses}" />
							</p:column>

							<p:column headerText="${messages.date}" style="width:10px">
								<h:outputText value="#{inscription.insertiondate}">
									<f:convertDateTime type="both" pattern="dd/MM/yyyy" />
								</h:outputText>
							</p:column>

							<p:column headerText="${messages.afc}" style="width:60px">
								<h:outputText value="#{inscription.averageFuelConsumption}">
									<f:convertNumber maxFractionDigits="1" />
								</h:outputText>
							</p:column>

							<p:column headerText="${messages.price}">
								<h:outputText value="#{inscription.fuelPrice}" style="width:20px">
									<f:convertNumber currencyCode="PLN" locale="pl_PL" maxFractionDigits="2" type="currency" />
								</h:outputText>
							</p:column>
							<p:column headerText="${messages.kind}">
								<h:outputText value="#{inscription.fuelKind}" style="width:20px" />
							</p:column>
						</p:dataTable>
					</p:tab>
					<p:tab id="tab3" title="${messages.stat}">
						<p:graphicImage value="/resources/images/work.jpg" />
					</p:tab>
					<p:tab id="tab4" title="${messages.profile}">
						<p:graphicImage value="/resources/images/work.jpg" />
					</p:tab>
				</p:tabView>
			</h:form>
		</ui:define>

	</ui:composition>
</h:body>
</html>
